<!DOCTYPE HTML PUBLIC "-//ORA//DTD CD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>[Chapter 18] 18.2 java.awt.AWTEvent (JDK 1.1)</TITLE>
<META NAME="author" CONTENT="David Flanagan">
<META NAME="date" CONTENT="Thu Jul 31 16:09:15 1997">
<META NAME="form" CONTENT="html">
<META NAME="metadata" CONTENT="dublincore.0.1">
<META NAME="objecttype" CONTENT="book part">
<META NAME="otheragent" CONTENT="gmat dbtohtml">
<META NAME="publisher" CONTENT="O'Reilly &amp; Associates, Inc.">
<META NAME="source" CONTENT="SGML">
<META NAME="subject" CONTENT="Java">
<META NAME="title" CONTENT="Java in a Nutshell">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
</HEAD>
<body vlink="#551a8b" alink="#ff0000" text="#000000" bgcolor="#FFFFFF" link="#0000ee">

<DIV CLASS=htmlnav>
<H1><a href='index.htm'><IMG SRC="gifs/smbanner.gif"
     ALT="Java in a Nutshell" border=0></a></H1>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch18_01.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><B><FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1">Chapter 18<br>The java.awt Package</FONT></B></TD>
<td width=172 align=right valign=top><A HREF="ch18_03.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
</table>

&nbsp;
<hr align=left width=515>
</DIV>
<DIV CLASS=sect1>
<h2 CLASS=sect1><A CLASS="TITLE" NAME="JNUT2-CH-18-SECT-2">18.2 java.awt.AWTEvent (JDK 1.1)</A></h2>

<DIV CLASS=sect2>
<h3 CLASS=sect2><A CLASS="TITLE" NAME="JNUT2-CH-18-SECT-2.1"></A></h3>
</DIV>

<P CLASS=para>
This abstract class serves as the root event type for all
AWT events in Java 1.1 and supersedes the <tt CLASS=literal>Event</tt>
class which was used in Java 1.0.

<P CLASS=para>
Each <tt CLASS=literal>AWTEvent</tt> has a source object, as all
<tt CLASS=literal>EventObject</tt> objects do.  You can query the source of
an event with the inherited <tt CLASS=literal>getSource()</tt> method.  The
<tt CLASS=literal>AWTEvent</tt> class adds an event type, or "id," for every
AWT event.  Use <tt CLASS=literal>getID()</tt> to query the type of the
event.  Subclasses of <tt CLASS=literal>AWTEvent</tt> define various
constants for this type field.

<P CLASS=para>
The various <tt CLASS=literal>_MASK</tt> constants defined by this class
allow <tt CLASS=literal>Component.enableEvents()</tt> to be called by applets and
custom components that want to receive various 
event types without having to register an
<tt CLASS=literal>EventListener</tt> object to receive them.  

<DIV CLASS=screen>
<P>
<PRE>
public abstract class <tt CLASS=literal>AWTEvent</tt> extends EventObject {
    // <tt CLASS=literal>Public Constructors</tt>
            public <tt CLASS=literal>AWTEvent</tt>(Event <tt CLASS=literal>event</tt>);
            public <tt CLASS=literal>AWTEvent</tt>(Object <tt CLASS=literal>source</tt>, int <tt CLASS=literal>id</tt>);
    // <tt CLASS=literal>Constants</tt>
            public static final long <tt CLASS=literal>ACTION_EVENT_MASK</tt>;
            public static final long <tt CLASS=literal>ADJUSTMENT_EVENT_MASK</tt>;
            public static final long <tt CLASS=literal>COMPONENT_EVENT_MASK</tt>;
            public static final long <tt CLASS=literal>CONTAINER_EVENT_MASK</tt>;
            public static final long <tt CLASS=literal>FOCUS_EVENT_MASK</tt>;
            public static final long <tt CLASS=literal>ITEM_EVENT_MASK</tt>;
            public static final long <tt CLASS=literal>KEY_EVENT_MASK</tt>;
            public static final long <tt CLASS=literal>MOUSE_EVENT_MASK</tt>;
            public static final long <tt CLASS=literal>MOUSE_MOTION_EVENT_MASK</tt>;
            public static final int <tt CLASS=literal>RESERVED_ID_MAX</tt>;
            public static final long <tt CLASS=literal>TEXT_EVENT_MASK</tt>;
            public static final long <tt CLASS=literal>WINDOW_EVENT_MASK</tt>;
    // <tt CLASS=literal>Protected Instance Variables</tt>
            protected boolean <tt CLASS=literal>consumed</tt>;
            protected int <tt CLASS=literal>id</tt>;
    // <tt CLASS=literal>Public Instance Methods</tt>
            public int <tt CLASS=literal>getID</tt>();
            public String <tt CLASS=literal>paramString</tt>();
            public String <tt CLASS=literal>toString</tt>();  //<tt CLASS=literal> Overrides EventObject</tt>
    // <tt CLASS=literal>Protected Instance Methods</tt>
            protected void <tt CLASS=literal>consume</tt>();
            protected boolean <tt CLASS=literal>isConsumed</tt>();
}
</PRE>
</DIV>

</DIV>

<DIV CLASS=sect2>
<h3 CLASS=sect2><A CLASS="TITLE" NAME="JNUT2-CH-18-SECT-2.2">Hierarchy:</A></h3>

<P CLASS=para>
<tt CLASS=literal>Object->EventObject(Serializable)->AWTEvent</tt>

</DIV>

<DIV CLASS=sect2>
<h3 CLASS=sect2><A CLASS="TITLE" NAME="JNUT2-CH-18-SECT-2.3">Extended By:</A></h3>

<P CLASS=para>
<tt CLASS=literal>ActionEvent, 
AdjustmentEvent, 
ComponentEvent, 
ItemEvent, 
TextEvent</tt>

</DIV>

<DIV CLASS=sect2>
<h3 CLASS=sect2><A CLASS="TITLE" NAME="JNUT2-CH-18-SECT-2.4">Passed To:</A></h3>

<P CLASS=para>
<tt CLASS=literal>Button.processEvent(), 
Checkbox.processEvent(), 
CheckboxMenuItem.processEvent(), 
Choice.processEvent(), 
Component.dispatchEvent(), 
Component.processEvent(), 
ComponentPeer.handleEvent(), 
Container.processEvent(), 
EventQueue.postEvent(), 
List.processEvent(), 
MenuComponent.dispatchEvent(), 
MenuComponent.processEvent(), 
MenuItem.processEvent(), 
Scrollbar.processEvent(), 
TextComponent.processEvent(), 
TextField.processEvent(), 
Window.processEvent()</tt>

</DIV>

<DIV CLASS=sect2>
<h3 CLASS=sect2><A CLASS="TITLE" NAME="JNUT2-CH-18-SECT-2.5">Returned By:</A></h3>

<P CLASS=para>
<tt CLASS=literal>EventQueue.getNextEvent(), 
EventQueue.peekEvent()</tt>

</DIV>

</DIV>


<DIV CLASS=htmlnav>

<P>
<HR align=left width=515>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch18_01.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><a href="index.htm"><img src='gifs/txthome.gif' border=0 alt='Home'></a></td>
<td width=172 align=right valign=top><A HREF="ch18_03.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
<tr>
<td width=172 align=left valign=top>java.awt.AWTError (JDK 1.0)</td>
<td width=171 align=center valign=top><a href="index/idx_0.htm"><img src='gifs/index.gif' alt='Book Index' border=0></a></td>
<td width=172 align=right valign=top>java.awt.AWTEventMulticaster (JDK 1.1)</td>
</tr>
</table>
<hr align=left width=515>

<IMG SRC="gifs/smnavbar.gif" USEMAP="#map" BORDER=0> 
<MAP NAME="map"> 
<AREA SHAPE=RECT COORDS="0,0,108,15" HREF="../javanut/index.htm"
alt="Java in a Nutshell"> 
<AREA SHAPE=RECT COORDS="109,0,200,15" HREF="../langref/index.htm" 
alt="Java Language Reference"> 
<AREA SHAPE=RECT COORDS="203,0,290,15" HREF="../awt/index.htm" 
alt="Java AWT"> 
<AREA SHAPE=RECT COORDS="291,0,419,15" HREF="../fclass/index.htm" 
alt="Java Fundamental Classes"> 
<AREA SHAPE=RECT COORDS="421,0,514,15" HREF="../exp/index.htm" 
alt="Exploring Java"> 
</MAP>
</DIV>

</BODY>
</HTML>
